<% layout('/layouts/default.html', {title: '颜色列表', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${text('商品券列表')}
			</div>
			<div class="box-tools pull-right">
				
				
					<a href="${ctx}/ztGoodsquan/form" class="btn btn-default btnTool" title="${text('新增券')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
				
			</div>
		</div>
		<div class="box-body">
			 <#form:form id="searchForm" model="${ztGoodsquan}" action="${ctx}/ztGoodsquan/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
												
				
			</#form:form> 
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [     
		{header:'${text('优惠券类型')}', name:'ztQuan.name', index:'q.type', width:100, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('zt_quan_type')}, val, '${text('活动优惠券')}', true);
		}},
		{header:'${text('优惠券券名')}', name:'ztQuan.name',index:'q.name',  width:150, align:"center"},
		{header:'${text('图片')}', name:'ztQuan.img',  width:110, align:"center",formatter: function(val, obj, row, act){
			return '<img style="width:50px;height:40px;" src="'+val+'"></img>';
		}},
		{header:'${text('优惠券优惠金额')}', name:'ztQuan.price', index:'q.price', width:160, align:"center"},
		{header:'${text('剩余数量')}', name:'overCount', index:'q.over_count', width:110, align:"center"},
		
		{header:'${text('到期时间')}', name:'toTime', index:'q.to_time', width:160, align:"center"},
		{header:'${text('状态')}', name:'usestatus', index:'q.usestatus', width:90, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('zt_usestatus_type')}, val, '${text('有效')}', true);
		}},
				
		{header:'${text('操作')}',align:"center", name:'actions', width:100, sortable:false, title:false, formatter: function(val, obj, row, act){
			var actions = [];
			
				actions.push('<a href="${ctx}/ztGoodsquan/delete?id='+row.id+'" class="btnList" title="${text('删除商品')}" data-confirm="${text('确认要删除该数据吗？')}"><i class="fa fa-trash-o"></i></a>&nbsp;');

			return actions.join('');
		}}	
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>